fix: monorepo-aware setup commands and domain discovery improvements#67
Merged
LadyBluenotes merged 4 commits intomainfrom Mar 11, 2026
Merged
fix: monorepo-aware setup commands and domain discovery improvements#67LadyBluenotes merged 4 commits intomainfrom
LadyBluenotes merged 4 commits intomainfrom
Conversation
- Add hard rule #3 to domain-discovery: never ask factual questions the agent can answer by searching the codebase. Distinguishes factual questions (grep it) from judgment questions (ask the maintainer). - Expand Phase 1a to read all in-repo markdown docs before the first interview, preventing the agent from asking questions docs already answer. - Make edit-package-json and add-library-bin monorepo-aware: when run from a monorepo root, they find all workspace packages containing SKILL.md files and apply changes to each package's package.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Unify MonorepoEditResult/MonorepoBinResult into generic MonorepoResult<T> - Extract runForEachPackage<T> to deduplicate monorepo-aware wrappers - Add warning logs to empty catch blocks in readWorkspacePatterns - Add error handling for readdirSync in collectPackageDirs - Skip hidden directories during recursive workspace walks - Distinguish "not a monorepo" from "monorepo with no skill packages" to avoid modifying root package.json incorrectly - Add tests for monorepo-aware edit-package-json and add-library-bin Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merged
commit: |
AlemTuzlak
approved these changes
Mar 11, 2026
LadyBluenotes
approved these changes
Mar 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
edit-package-jsonandadd-library-binnow auto-detect monorepo roots and apply to all workspace packages that contain SKILL.md files, fixing the issue where only the root package.json was modifiedRoot Cause
When a library maintainer ran
npx @tanstack/intent edit-package-jsonfrom a monorepo root, the command operated onprocess.cwd()only — modifying the rootpackage.jsoninstead of each workspace package'spackage.json. This meant"skills"and"bin"were never added to the individual packages, sonpm publishexcluded the skills directories entirely.Separately, the domain-discovery skill's hard rules enforced interactive interviews so strictly that the agent would ask factual questions ("are there other backward compat middlewares?") instead of just grepping the codebase. And Phase 1 only read README + quickstart, not the full in-repo docs, so the agent lacked context it could have gathered autonomously.
Approach
Monorepo resolution (
setup.ts):readWorkspacePatterns()— reads workspace globs frompnpm-workspace.yamlorpackage.jsonworkspacesresolveWorkspacePackages()— resolves glob patterns (packages/*,packages/**) to actual package directoriesfindPackagesWithSkills()— filters to packages containing at least one SKILL.md filerunForEachPackage<T>()— generic wrapper that runs a command on each matching package, with proper fallback semanticsKey invariant: if workspace config is detected but no packages have skills, the command warns and returns empty — it never falls through to modify the monorepo root's
package.json.Domain discovery (
SKILL.md):.mdfiles before the first interviewNon-goals
setup-github-actions(it operates on the repo root by design)validatecommand (it already accepts a directory argument)Trade-offs
The workspace glob resolution is a simple
readdirSync-based implementation rather than using a full glob library. This handles the common patterns (packages/*,examples/**/*) but won't handle complex globs likepackages/{foo,bar}. This covers the vast majority of real monorepo layouts; a full glob library can be added later if needed.Verification
Files changed
meta/domain-discovery/SKILL.mdsrc/cli.ts*Allvariantssrc/setup.tsMonorepoResult<T>,runForEachPackage<T>, error handlingtests/setup.test.ts🤖 Generated with Claude Code